<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="fhdb" content="true">
    <title>百瑞花苑</title>
    <link rel="stylesheet" href="../main/css/Navigation.css">
    <link rel="stylesheet" href="../main/css/index.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="../main/css/rushBuy.css" rel="stylesheet" />

    <link type="text/css" rel="stylesheet" href="../main/css/style.css" />
    <script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
    <link rel="stylesheet" href="../main/css/swiper.min.css">
    <script src="../main/js/swiper.min.js"></script>
</head>
<body>
<div class="topTitle">
    百瑞花苑
</div>
<!-- 轮播图 -->
<div class="swiper-container banner_swiper1">
    <div class="swiper-wrapper">
        <div class="swiper-slide">
            <img src = "/images/lb1.jpg"/>
        </div>
        <div class="swiper-slide">
            <img src = "/images/lb1.jpg"/>
        </div>
        <div class="swiper-slide">
            <img src = "/images/lb1.jpg"/>
        </div>
    </div>
    <!-- 分页器 -->
    <div class="swiper-pagination">
    </div>
</div>
<!-- 跑马灯广告 -->
<div class="advertisement" onclick="pmdclick()">
    <span id="tbtitle"></span>
    <div class="line">|</div>
    <marquee behavior="scroll" id="tbcontent"></marquee>
</div>
<div id="stayBuy">
    <div class="stayBuy" onClick="swq()" style="height: 180px;">
        <img src="/images/swc.jpg" />
        <div class="stayBuyBottom">
            <div class="transactionTime">交易时间：11点-12点</div>
        </div></div>
</div>
<div class="stayBuy" onClick="xwq()" style="height: 180px;">
    <img src="/images/xwc.jpg" />
    <div class="stayBuyBottom">
        <div class="transactionTime">交易时间：15点-16点</div>
    </div></div>
</div>
<div class="stayBuy" onClick="csq()" style="height: 180px;">
    <img src="/images/csc.jpg" />
    <div class="stayBuyBottom">
        <div class="transactionTime">交易时间：8点-23点</div>
    </div></div>
</div>
<div style="height: 80px;">
</div>
<!-- 导航栏 -->
<nav class="navbar navbar-default navbar-fixed-bottom">
    <div class="container">

        <div class="nav-item home active" onclick="first()">
            <img src="/images/26e851c369bfb1286981fc84fb4213a.png"/>
        </div>
        <div class="nav-item order" onclick="order()">
            <img style="width: 65px;height:50px;" src="/images/dd.png" />

        </div>
        <div class="nav-item order" >
            <img src="/images/9c2d68926e3287110b1970ba852c175.png" />
        </div>
        <div class="nav-item mine" onclick="my()">
            <img src="/images/82680fee0b8895ef743c22bf6d92ec8.png" />

        </div>
    </div>
</nav>
</body>
<script type="text/javascript">
    window.history.forward(1);
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL);
    });

    $(function(){
        //消除后退的所有动作。包括 键盘、鼠标手势等产生的后退动作。，用户登录到系统中后，浏览器回退按钮失效，只能点击退出按钮退出系统！
        history.pushState(null, null, document.URL);
        window.addEventListener('popstate', function () {
            history.pushState(null, null, document.URL);
        });
    });

    function order() {
        window.location.href = 'http://br.bairuihuayuan.com:8081/ftl/main/order.html';
    }
    function my() {
        location.href = 'http://br.bairuihuayuan.com:8081/ftl/main/personalCenter.html';
    }
    function swq() {
        window.location.href = "http://br.bairuihuayuan.com:8081/ftl/shop/productDetails.html?type=1";

    }
    function xwq() {
        window.location.href = "http://br.bairuihuayuan.com:8081/ftl/shop/productDetails.html?type=2";

    }
    function csq() {
        window.location.href = "http://br.bairuihuayuan.com:8081/ftl/shop/productDetails.html?type=3";

    }
    var path = "";
    $(document).ready(function () {

        // 轮播图
        $.ajax({
            type: "POST",
            contentType: "application/json;charset=UTF-8",
            url: "BaseRefWeb.aspx?stype=ISpBannerFun&method=GetBanner&type=sp",
            success: function (result) {
                var data = JSON.parse(result);
                var html = '';
                for (var i = 0; i < data.length; i++) {
                    var src = data[i].TB_BANNER_PATH;
                    var href = data[i].TB_BANNER_LIANJIE;
                    html += '<div class="swiper-slide"><a href="' + href+'"><img src = "' + src + '"/></a></div >';
                }
                $(".swiper-wrapper").append(html);
                var mySwiper = new Swiper('.banner_swiper1', {
                    loop: true,
                    autoplay: { disableOnInteraction: false },
                    //小圆点
                    pagination: {
                        el: '.swiper-pagination',
                    }
                });
            }
        });
        $('.container').on('click', '.nav-item', function () {
            const $this = $(this)
            const index = $this.index()
            $.ajax({
                type: "POST",
                contentType: "application/json;charset=UTF-8",
                url: "order/getData",
                success: function (result) {

                }})
            $this.addClass('active').siblings().removeClass('active')

            switch (index) {
                case 0:
                    location.href = 'http://br.bairuihuayuan.com:8081/indexshop.html';
                    break
                case 1:
                    location.href = 'http://br.bairuihuayuan.com:8081/ftl/main/order.html';
                    break
                case 3:
                    location.href = 'http://br.bairuihuayuan.com:8081/ftl/main/personalCenter.html';
                    break

            }
        })
    });
    $(function () {
        //商品类别
        $.ajax({
            type: "POST",
            contentType: "application/json;charset=UTF-8",
            url: "BaseRefWeb.aspx?stype=ISpGoodstypeFun&method=DoSpGoodsType&type=sp",
            success: function (result) {
                var data = JSON.parse(result);
                if (data.msg == "_timeout") {
                    window.location.href = "Manage/UserLogin/Login.html";
                }
                else {
                    if (data.length > 0) {
                        console.log(data);
                        var html = "";
                        for (var i = 0; i < data.length; i++) {
                            html += '<div class="stayBuy" onClick="product(\'' + data[i].ID + '\')">';
                            html += '<img src="' + data[i].TB_GOODSTYPE_PATH + '" />';
                            html += '<div class="stayBuyBottom">';
                            html += '<div class="transactionTime">交易时间：' + data[i].TB_START_HOURS + '点-' + data[i].TB_END_HOURS + '点</div>';
                            html += '</div><div class="stayBuyTop">待抢购</div></div>';
                        }
                        $("#stayBuy").append(html);
                    }
                }
            }
        });
        //跑马灯
        $.ajax({
            type: "POST",
            contentType: "application/json;charset=UTF-8",
            url: "BaseRefWeb.aspx?stype=ISpNoticeFun&method=GetNotice&type=sp",
            success: function (result) {
                var data = JSON.parse(result);
                $("#tbtitle").text(data.TB_TITLE);
                $("#tbcontent").text(data.TB_CONTENT);
                path = data.TB_PATH;
            }
        });
    })
    function product(id) {
        window.location.href = "Manage/shop/productDetails.html?id=" + id + "";
    }
    function pmdclick() {
        location.href = path;
    }
</script>
</html>